package jabachat;

import java.awt.Desktop;
import java.io.IOException;
import java.net.URISyntaxException;
import java.net.URL;

/**
 *
 * @author fgssdfs
 */
public class DefaultBrowser {

    public static String os = System.getProperty("os.name").toLowerCase();
    public static Runtime rt = Runtime.getRuntime();

    public static void browse(URL url) {
        try {   //in my linux java always launches firefox
            if (os.indexOf("nix") >= 0 || os.indexOf("nux") >= 0) {
                rt.exec("x-www-browser " + url.toString());
            } else {
                Desktop.getDesktop().browse(url.toURI());
            }
        } catch (Exception e) {
            System.err.println(e);
        }

    }
}
